package 链表;

/**
 * @Author: biubiu0002
 * @Date: 2021-06-18 13:47
 **/
public class 链表中环的检测 {

    public static void main(String[] args) {

    }

    public boolean circleCheck(ListNode head){
        ListNode dummy = new ListNode(-1);
        dummy.next=head;
        ListNode slow = dummy,fast = head;
        while(fast!=null&&fast.next!=null){
            if(slow==fast){
                return true;
            }

            slow=slow.next;
            fast=fast.next.next;
        }
        return false;

    }


}
